package com.newasia.management.dto.productSkuPerm;

import com.newasia.commons.result.AbstractRequest;
import com.newasia.commons.tool.exception.ValidateException;
import com.newasia.management.constants.ManagementRetCode;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * 腾讯课堂搜索【咕泡学院】
 * 官网：www.gupaoedu.com
 * 风骚的Mic 老师
 * create-date: 2019/7/31-19:21
 */
@Data
public class ChangeSkuPermRequest extends AbstractRequest {

    private List<Double> percentage;

    private List<Double> money;

    private Integer type;

    private List<Long> skuIdList;

    private List<Long>  dealerIdList;

//    private  List<SkuPermDto> permsList;



    @Override
    public void requestCheck() {


        if (skuIdList.size() <= 0 || skuIdList == null || dealerIdList.size() <= 0 || dealerIdList == null || money.size() <= 0 || money == null || percentage == null || percentage.size() <= 0 || type == null) {

            throw new ValidateException(
                    ManagementRetCode.REQUISITE_PARAMETER_NOT_EXIST.getCode(),
                    ManagementRetCode.REQUISITE_PARAMETER_NOT_EXIST.getMessage());

        }

        if(percentage.size()!=dealerIdList.size()||percentage.size()!=money.size()){
            throw new ValidateException(
                    ManagementRetCode.REQUISITE_PARAMETER_NOT_EXIST.getCode(),
                    ManagementRetCode.REQUISITE_PARAMETER_NOT_EXIST.getMessage());

        }
    }
}
